package com.weibo.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexVerify {

	public static boolean verify(String regex, String input) {
		Pattern pattern = Pattern.compile(regex);
		Matcher matcher = pattern.matcher(input);
		boolean isMatch = matcher.matches();
		return isMatch;
	}
	
	public static boolean verifyUsername(String input) {
		Pattern pattern = Pattern.compile("^[a-zA-Z0-9\u4e00-\u9fa5]+$");
		Matcher matcher = pattern.matcher(input);
		boolean isMatch = matcher.matches();
		return isMatch;
	}
	
	public static boolean verifyPassword(String input) {
		Pattern pattern = Pattern.compile("^.{6,20}$");
		Matcher matcher = pattern.matcher(input);
		boolean isMatch = matcher.matches();
		return isMatch;
	}
}
